package com.wnxy;

/**
* 栈超出最大深度：StackOverflowError
* VM args: -Xss128k
**/
public class App4 {
    // 定义变量，记录栈的深度
    private int stackLength = 1;
    // 定义方法
    public void stackLeak(){
        stackLength++;
        stackLeak();
    }
    
    public static void main(String[] args) {
        App4 app = new App4();
        try {
            app.stackLeak();
        } catch (Throwable e) {
            System.out.println("当前栈深度:" + app.stackLength);
            e.printStackTrace();
        }
    }
}